<template>
	<view class="bg-co-g wdh-100 columnbox content jus">
		<view @click="selCoupon(item)" v-for="(item,index) in couponList" :key='index' class="coupon-one rowbox spb als">
			<view class="bgcoupon">
				<image class="img" src="../../static/img/couponBlue.png" mode=""></image>
			</view>
			<view class="columnbox left-box">
				<view class="coupon-num-box">{{item.price}} <text>元</text> </view>
				<view class="coupon-rule">满{{item.fullprice}}元使用</view>
			</view>
			<view class="right-box columnbox als">
				<view class="rowbox wdh-100 spb">
					<view class="coupon-title">{{item.name}}</view>
					<!-- <view class="rowbox use-btn" @click="editCoupon(item.id)">编辑</view> -->
				</view>
				<view class="numcont">
					<view class="item">
						<view class="label">
							{{item.title}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shanghuid: 0,
				uid: 0,
				couponList: []
			};
		},
		onLoad(options) {
			this.shanghuid = parseInt(options.shanghuid)
			this.uid = parseInt(options.uid)
			this.getList()
		},
		methods: {
			getList() {
				this.$req.post('/shanghu/couponuser', {
					shanghuid: this.shanghuid,
					uid: this.uid
				}).then(res => {
					this.couponList = res.data.data
				})
			},
			selCoupon(v){
				let pages = getCurrentPages(); //获取所有页面栈实例列表
				let nowPage = pages[pages.length - 1]; //当前页页面实例
				let prevPage = pages[pages.length - 2]; //上一页页面实例
				prevPage.$vm.curcoupon = v
				uni.navigateBack()
			}
		}
	}
</script>


<style lang="scss">
	.weekNotice {
		padding: 15rpx 30rpx;
		position: fixed;
		bottom: 240rpx;
		left: 0;
		z-index: 100;
		width: 100%;
		background-color: #fdf6ec;
		color: #f9ae3d;
		font-size: 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.footerbtncont {
		position: fixed;
		width: 100%;
		height: 240rpx;
		padding: 10rpx 24rpx 0 24rpx;
		border-top: 1px solid #edf0f2;
		left: 0;
		bottom: 0;
		z-index: 5;

		.zfbtn {
			margin-top: 20rpx;
		}
	}

	.numcont {
		display: flex;
		padding-top: 20rpx;

		.item {
			display: flex;
			margin-right: 30rpx;
			font-size: 26rpx;

			.label {
				color: #999;
			}
		}
	}

	.content {
		min-height: 100vh;
		padding-bottom: 320rpx;
		background: #f3f6f8;
	}

	.coupon-one {
		width: 702rpx;
		height: 220rpx;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		margin-top: 20rpx;
		position: relative;

		.bgcoupon {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;

			.img {
				display: block;
				width: 100%;
				height: 100%;
			}
		}

		.left-box {
			height: 100%;
			width: 186rpx;
			position: relative;
			z-index: 2;

			.coupon-num-box {
				color: #fff;
				font-size: 70rpx;
				font-family: D-DIN Exp-DINExp, D-DIN Exp-DINExp;
				font-weight: bold;
				color: #FFFFFF;
				line-height: 70rpx;

				text {
					font-size: 22rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 26rpx;
				}
			}

			.coupon-rule {
				margin-top: 20rpx;
				font-size: 20rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 23rpx;
			}
		}

		.right-box {
			padding-left: 36rpx;
			width: calc(100% - 186rpx);
			margin-top: 32rpx;
			position: relative;
			z-index: 2;

			.coupon-title {
				font-size: 30rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: bold;
				color: #202020;
				line-height: 35rpx;
			}

			.use-btn {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: rgba(13, 90, 211, 0.77);
				line-height: 28rpx;
				height: 46rpx;
				border-radius: 40rpx;
				border: 2rpx solid #B1CDF9;
				margin-right: 36rpx;
				padding: 0 20rpx;
			}

			.coupon-notice {
				font-size: 20rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #7B838F;
				line-height: 23rpx;
				margin-top: 10rpx;
			}

			.coupon-date {
				font-size: 20rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 400;
				color: #6D798A;
				line-height: 23rpx;
				margin-top: 20rpx;
			}
		}
	}

	.add-btn {
		color: #fff;
		width: 100%;
		height: 80rpx;
		border-radius: 100rpx;

	}
</style>